package com.foodorder.entity;

import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.time.LocalDateTime;

/**
 * 店铺关注实体类
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Entity
@Table(name = "store_follows", 
       uniqueConstraints = @UniqueConstraint(columnNames = {"user_id", "store_id"}))
@EntityListeners(AuditingEntityListener.class)
public class StoreFollow {
    
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    /**
     * 用户ID
     */
    @Column(name = "user_id", nullable = false)
    private Long userId;
    
    /**
     * 店铺ID
     */
    @Column(name = "store_id", nullable = false)
    private Long storeId;
    
    /**
     * 关注时间
     */
    @CreatedDate
    @Column(nullable = false, updatable = false)
    private LocalDateTime followedAt;
    
    /**
     * 是否接收推送通知
     */
    @Column(nullable = false)
    private Boolean receiveNotifications = true;
} 